package com.ztjava.score.listener;

import com.jfinal.aop.Duang;
import com.jfinal.kit.Ret;
import com.ztjava.core.bean.sub.ScoreBean;
import com.ztjava.plugin.event.EventTag;
import com.ztjava.plugin.event.core.ApplicationListener;
import com.ztjava.plugin.event.core.Listener;
import com.ztjava.plugin.event.core.RequestEvent;
import com.ztjava.score.service.ScoreService;

@Listener(tag=EventTag.SCORE_UPDATE)
public class UpdateScoreListener implements ApplicationListener<RequestEvent>{
	private static ScoreService scoreService = Duang.duang(ScoreService.class);
	@Override
	public Ret onApplicationEvent(RequestEvent event) {
		ScoreBean scoreBean = (ScoreBean)event.getSource();
		Ret ret = scoreService.updateScore(scoreBean.getUser_id(), 
				scoreBean.getScore_type(), scoreBean.getScore(), 
				scoreBean.getRemark(), scoreBean.getCreate_user());
		return ret;
	}

}
